package com.jsb.laundry.model.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@ApiModel(value = "支付数据模型")
public class PayModeRequest {

    @ApiModelProperty(value = "支付方式(JSB_USER_WECHAT_MINI_PAY:微信支付-小程序)",required = true ,example = "JSB_USER_WECHAT_MINI_PAY")
    private String payMode;

    @ApiModelProperty(value = "用户id",required = true)
    private String userId;

    @ApiModelProperty(value = "使用的卡券id(例: 优惠券、月卡 )",required = true)
    private String cardId;

    @ApiModelProperty(value = "订单中购买的商品",hidden = true)
    private List<OrderInfo> orderInfoList;

    @ApiModelProperty(value = "订单id",required = true)
    private String orderId;


    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Accessors(chain = true)
    @ApiModel(value = "订单商品详情")
    public static class OrderInfo implements Serializable,Cloneable{

        @ApiModelProperty(value = "商品id",required = true)
        private String goodsId;

        @ApiModelProperty(value = "父订单id")
        private String orderId;

        @ApiModelProperty(value = "子订单id")
        private String subOrderId;

        @ApiModelProperty("商品名称")
        private String goodsName;

        @ApiModelProperty("商品图片")
        private String goodsImg;

        @ApiModelProperty(value = "服务价格id",required = true)
        private String serveId;

        @ApiModelProperty("服务类别描述")
        private String serveMsg;

        @ApiModelProperty("服务价格(单价)")
        private String servePrice;

        @ApiModelProperty(value = "购买量",required = true)
        private int buyNum;

        @ApiModelProperty("原价(单价*购买数量)")
        private String originalPrice;

        @ApiModelProperty("实付金额 (单价*购买数量*折扣)")
        private String total;

        @ApiModelProperty("分类id")
        private String cateId;

        @ApiModelProperty("分类名")
        private String cateName;

        @ApiModelProperty("权益")
        private String equityExplain;

        @Override
        public Object clone() {
            try {
                return (OrderInfo) super.clone();
            } catch (CloneNotSupportedException e) {
                throw new RuntimeException(e);
            }
        }
    }

}
